#include "Response.h"

namespace gitstore {

Response::Response()
    : Response(Success, Json::nullValue)
{

}

Response::Response(ErrorStatus s)
    : Response(s, Json::nullValue)
{

}

Response::Response(ErrorStatus s, const Json::Value& d) : status(s), msg(CErrorCodeManager::getInstance()->getErrorMessage(status)), data(d)
{

}

Response::operator std::string() const
{
    Json::Value val;
    val["code"] = status;
    val["message"] = msg;
    val["data"] = data;
    return val.toStyledString();
}

}
